#!/usr/bin/env python
#coding=utf-8

import re
import sys

for line in sys.stdin:
    val = line.strip()
    try:
        (year, temp, q) = (val[15:19],val[87:92],val[92:93])
    except:
        (year, temp, q) = (2014,25,1)
    # print ("{},{},{}".format(year,temp,q))
    if temp!= "+9999" and re.match("[01459]",q):
        print "%s,%s"%(year,temp)
